<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="sub">-</button>
    <input type="text" class="ipt" value="10">
    <button class="add">+</button>
</body>
</html>
<script>

    function initTxt(n){
        const sum = n

        return {
            run(){
                return sum
            },
            get(val){
                return sun = val
            }
        }
    }


    const sub = document.querySelector('.sub')
    const add = document.querySelector('.add')
    const ipt = document.querySelector('.ipt')

    let txt = +ipt.value

    sub.onclick = function(){
        txt--
        ipt.value = txt
    }
    add.onclick = function(){
        txt++
        ipt.value = txt
    }


</script>